//------人员测算方案----------

import request from "@/router/axios";


//查询
export function fetchList(query) {
  return request({
    url: '/bonus/bonuspersoncompute/page',
    method: 'get',
    params: query
  })
}

//新增
export function addObj(obj) {
  return request({
    url: '/bonus/bonuspersoncompute',
    method: 'post',
    data: obj
  })
}

//编辑
export function putObj(obj) {
  return request({
    url: '/bonus/bonuspersoncompute',
    method: 'put',
    data: obj
  })
}


//删除
export function deleteBatch(query) {
  return request({
    url: '/bonus/bonuspersoncompute/deleteBatch',
    method: 'get',
    params: query
  })
}


//测算 - 获取测算方案id 奖金池金额
export function getProgrammeId(obj) {
  return request({
    url: '/bonus/bonuspersoncomputesub',
    method: 'post',
    data: obj
  })
}


//新增测算人员/虚拟组
export function addUserList(obj) {
  return request({
    url: '/bonus/bonuspersoncomputedetail/saveList',
    method: 'post',
    data: obj
  })
}

//保存公式
export function saveFormula(id,formulaId) {
  return request({
    url: '/bonus/bonuspersoncomputesub/saveFormula/'+ id + '/' + formulaId,
    method: 'get',
  })
}

//单元格的值改变时
export function saveCell(query) {
  return request({
    url: '/bonus/bonuspersoncomputedetail/updateSingle',
    method: 'get',
    params:query
  })
}

//获取要测算的人员列表
export function measureOrgList(query) {
  return request({
    url: '/bonus/bonuspersoncomputedetail/list',
    method: 'get',
    params:query
  })
}



//计算
export function compute(query) {
  return request({
    url: '/bonus/bonuspersoncomputedetail/toCompute',
    method: 'get',
    params:query
  })
}


//保存选择参与计算的项
export function saveConfigItem(obj) {
  return request({
    url: '/bonus/bonuspersoncompute/saveViewColumn' ,
    method: 'put',
    data: obj
  })
}

//测算 - 获取配置的动态列(与列表页的【配置】中选择的有关)
export function getViewColumn(id) {
  return request({
    url: `/bonus/bonuspersoncompute/getViewColumn/${id}`,
    method: 'get',
  })
}


//保存- 给子奖金项分配金额功能
export function saveBonusCount(obj) {
  return request({
    url: '/bonus/bonuspersoncompute/saveSublist',
    method: 'post',
    data: obj
  })
}

//方案对比 - 获取动态列
export function getUserColumns(query) {
  return request({
    url: '/bonus/bonuspersoncompute/compare',
    method: 'get',
    params: query
  })
}

//将方案提交至工作流
export function submitToProcess(computeId) {
  return request({
    url: '/bonus/bonuspersoncompute/complete/' + computeId,
    method: 'get',
  })
}
